#ifndef __chrono
#define __chrono

#include <ctime>
#include <time.h>

void find_elapsed (const timespec& start, const timespec& end, timespec& result);

struct chrono { // nanosecond precision clock

  timespec start, now, result;
  double secs;
  double scale; // speeds up (> 1) or slows down (0 < scale < 1)
  void reset ();
  void tick ();
  chrono (double _scale = 1);
};

#endif
